import { defineStore } from "pinia";
// 关键数据要限制类型
import { ref } from "vue";
// 勾引 面试官 es6 module 问题
import type { HomeTopBarItem, ViewItem } from "../types/home.ts";

export const useHomeStore = defineStore("home", () => {
  //  topBarState 响应式状态 topBarState  topBarState.value
  const topBarState = ref<HomeTopBarItem[]>([
    {
      title: "礼物榜",
      icon: "gift-o",
    },
    {
      title: "好评榜",
      icon: "good-job-o",
    },
    {
      title: "热销榜",
      icon: "hot-o",
    },
    {
      title: "店铺榜",
      icon: "shop-o",
    },
    {
      title: "增长榜",
      icon: "chart-trending-o",
    },
  ]);

  const navBarState = ref<HomeTopBarItem[]>([
    {
      title: "热卖",
      icon: "hot-o",
    },
    {
      title: "新品",
      icon: "new-o",
    },
    {
      title: "我的",
      icon: "manager-o",
    },
    {
      title: "快递",
      icon: "free-postage-o",
    },
    {
      title: "更多",
      icon: "more-o",
    },
  ]);

  // const ViewedState = ref<ViewItem[]>([
  //     {
  //         id: 1,
  //         name: "衣服1",
  //         description: '秋季新款',
  //         cover:
  //           "https://cbu01.alicdn.com/img/ibank/O1CN01ySGX2u1h5YXOUoWFf_!!2211048734226-0-cib.jpg",
  //         price: 173,
  //         quantity: 1,
  //       },
  //       {
  //         id: 2,
  //         name: '衣服2',
  //         description: '冬季羽绒加厚防寒防冻加绒有帽子有口袋',
  //         quantity: 1,
  //         cover:"https://ts1.cn.mm.bing.net/th/id/R-C.9a63f07dd802b5b550ff8c596296bed1?rik=ETiAK2w4umoDNw&riu=http%3a%2f%2fimg2.selfimg.com.cn%2fuedvoguecms%2f2019%2f02%2f27%2f1551282660_19Ur1q.jpg&ehk=dJqKsYT2y6wE5whGeLd9R9wkkpKOb%2fRj9LQVYeRM7Ak%3d&risl=&pid=ImgRaw&r=0",
  //         price: 43,

  //       },
  //       {
  //         name: "衣服3",
  //         cover:
  //           "https://ts1.cn.mm.bing.net/th/id/R-C.c527a37731d854d74fc8a240377f85f3?rik=31g8Y6ReRwj61Q&riu=http%3a%2f%2fa.vpimg2.com%2fupload%2fmerchandise%2f31042%2fMBSKY-0112133-445-3.jpg&ehk=c%2bhvHGideO6wADEhV7246ixE8lEXjGPXzutkhpptsMs%3d&risl=&pid=ImgRaw&r=0",
  //         price: 78,
  //         id: 3,
  //         description: '夏季凉款',
  //         quantity: 1,
  //       },
  //       {
  //         name: "衣服",
  //         cover:
  //           "https://ts1.cn.mm.bing.net/th/id/R-C.c06c9d64fe4a8a30f02a40e62bd621a7?rik=sqYDGXinH19RkA&riu=http%3a%2f%2fimg.alicdn.com%2ftfscom%2fi3%2f2210292140%2fTB2HqHqgEdnpuFjSZPhXXbChpXa_!!2210292140.jpg&ehk=yaX7TiRoNhfc7LG78KBEyoS3WnfuJoZlpBBU4pFCfpU%3d&risl=&pid=ImgRaw&r=0",
  //         price: 873,
  //         id: 4,
  //         description: '夏季凉款',
  //         quantity: 1,
  //       },
  //       {
  //         name: "衣服",
  //         cover:
  //           "https://tse2-mm.cn.bing.net/th/id/OIP-C.Zpc-gNrQs9vKFxTwaF1tNQHaHa?rs=1&pid=ImgDetMain",
  //         price: 72,
  //         id: 5,
  //         description: '夏季凉款',
  //         quantity: 1,
  //       },
  //       {
  //         name: "衣服",
  //         cover:
  //           "https://ts1.cn.mm.bing.net/th/id/R-C.80fec10a165fffba132f12d51145c2e3?rik=Fgcgx9%2ba6M%2bLWg&riu=http%3a%2f%2fimg.china.alibaba.com%2fimg%2fibank%2f2013%2f489%2f359%2f1059953984_198386960.jpg&ehk=OgnZ3zvIBbd%2fhOqAbYogVwiIttVwOshRPMsOgMgjdyM%3d&risl=&pid=ImgRaw&r=0",
  //         price: 875.88,
  //         id: 6,
  //         description: '夏季凉款',
  //         quantity: 1,
  //       },

  // ])
  return {
    topBarState,
    navBarState,
  };
});
